#include "playback_funcs.h"



void playAudio(HWAVEOUT outputDevice, WAVEHDR hWaveOut, LPSTR lpData, WAVEFORMATEX pFormat){
	 //Opening output device
	 if(waveOutOpen(&outputDevice, WAVE_MAPPER, &pFormat, 0, 0, 
		  CALLBACK_NULL) != MMSYSERR_NOERROR) {
			fprintf(stderr, "%s: unable to open wave mapper device\n");
			ExitProcess(1);
	 }
	 waveOutPrepareHeader(outputDevice, &hWaveOut, sizeof(WAVEHDR));
	 printf("Starting playing recored sound");
	 waveOutWrite(outputDevice, &hWaveOut, sizeof(WAVEHDR));

	 do 
	 {
		 Sleep(100);
	 } 
	 while (!(hWaveOut.dwFlags & WHDR_DONE));
	 waveOutUnprepareHeader(outputDevice, &hWaveOut, sizeof(WAVEHDR));
	 waveOutClose(outputDevice);
	
 }

